<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      table {
        border: 1px solid;
      }
      td {
        border: 1px solid;
        width: 80px;
        height: 30px;
      }
    </style>
  </head>
  <body>
    <script>
      // x是行 y是列
      function createTable(x, y) {
        var body = document.querySelector("body");
        var table = document.createElement("table");
        for (var i = 0; i < x; i++) {
          var row = document.createElement("tr");
          for (var j = 0; j < y; j++) {
            var cell = document.createElement("td");
            // cell.textContent = `666`;
            row.appendChild(cell);
          }
          table.appendChild(row);
        }
        body.appendChild(table);
      }
      createTable(3, 4);
    </script>
  </body>
</html>
